import { AppRouteRecordRaw } from './routerUtils'
import { RoutesAlias, HOME_PAGE } from './routesAlias'
import Home from '@views/index/index.vue'

/**
 * 静态路由配置
 * 不需要权限就能访问的路由
 */
export const staticRoutes: AppRouteRecordRaw[] = [
  {
    path: '/',
    redirect: HOME_PAGE
  },
  {
    path: RoutesAlias.Login,
    name: 'Login',
    component: () => import('@views/common/login/index.vue'),
    meta: { title: 'menus.login.title', isHideTab: true, setTheme: true }
  },
  {
    path: RoutesAlias.Register,
    name: 'Register',
    component: () => import('@views/common/register/index.vue'),
    meta: { title: 'menus.register.title', isHideTab: true, noLogin: true, setTheme: true }
  },
  {
    path: RoutesAlias.ForgetPassword,
    name: 'ForgetPassword',
    component: () => import('@views/common/forget-password/index.vue'),
    meta: { title: 'menus.forgetPassword.title', isHideTab: true, noLogin: true, setTheme: true }
  },
  {
    path: '/',
    name: 'Top',
    component: () => import('@views/index/index.vue'),
    meta: {
      title: 'menus.dashboard.title',
      icon: '&#xe721;',
      keepAlive: false
    },
    children: [
        {
            path: '/form',
            name: 'Form',
            component: () => import('@views/common/Designer.vue'),
            meta: {
                title: 'menus.template.map',
                keepAlive: true,
                showTextBadge: 'new'
            }
        },
        {
            path: 'console',
            name: 'Console',
            component: () => import('@views/dashboard/console/index.vue'),
            meta: {
                title: 'menus.dashboard.console',
                keepAlive: true
            }
        },
        {
            path: 'analysis',
            name: 'Analysis',
            component: () => import('@views/dashboard/analysis/index.vue'),
            meta: {
                title: 'menus.dashboard.analysis',
                keepAlive: true
            }
        },
        {
            path: 'ecommerce',
            name: 'Ecommerce',
            component: () => import('@views/dashboard/ecommerce/index.vue'),
            meta: {
                title: 'menus.dashboard.ecommerce',
                keepAlive: true
            }
        },
      {
        path: RoutesAlias.Charts,
        name: 'Charts',
        component: () => import('@views/dashboard/Charts.vue'),
        meta: {
          title: 'menus.template.charts',
          keepAlive: false
        }
      },
      {
        path: RoutesAlias.Map,
        name: 'Map',
        component: () => import('@views/dashboard/Map.vue'),
        meta: {
          title: 'menus.template.map',
          keepAlive: true,
          showTextBadge: 'new'
        }
      },
      {
        path: RoutesAlias.Chat,
        name: 'Chat',
        component: () => import('@views/dashboard/Chat.vue'),
        meta: {
          title: 'menus.template.chat',
          keepAlive: true
        }
      },
      {
        path: RoutesAlias.Calendar,
        name: 'Calendar',
        component: () => import('@views/dashboard/Calendar.vue'),
        meta: {
          title: 'menus.template.calendar',
          keepAlive: true
        }
      },
      {
        path: RoutesAlias.Video,
        name: 'Video',
        component: () => import('@views/dashboard/Video.vue'),
        meta: {
          title: 'menus.widgets.video',
          keepAlive: true
        }
      },
      {
        path: RoutesAlias.WangEditor,
        name: 'WangEditor',
        component: () => import('@views/dashboard/WangEditor.vue'),
        meta: {
          title: 'menus.widgets.wangEditor',
          keepAlive: true
        }
      }
    ]
  },
  {
    path: '/exception',
    component: Home,
    name: 'Exception',
    meta: { title: 'menus.exception.title' },
    children: [
      {
        path: RoutesAlias.Exception403,
        name: 'Exception403',
        component: () => import('@views/result/403.vue'),
        meta: { title: '403' }
      },
      {
        path: '/:catchAll(.*)',
        name: 'Exception404',
        component: () => import('@views/result/404.vue'),
        meta: { title: '404' }
      },
      {
        path: RoutesAlias.Exception500,
        name: 'Exception500',
        component: () => import('@views/result/500.vue'),
        meta: { title: '500' }
      }
    ]
  },
  {
    path: '/outside',
    component: Home,
    name: 'Outside',
    meta: { title: 'menus.outside.title' },
    children: [
      {
        path: '/core/outside/iframe/:path',
        name: 'Iframe',
        component: () => import('@/views/common/outside/Iframe.vue'),
        meta: { title: 'iframe' }
      }
    ]
  }
]
